home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / ani11.zip / ANI.TXT < prev    next >
Text File  |  1993-04-24  |  4KB  |  110 lines

  1.  
  2.  
  3.         Animated Cursor Resource (.ANI) File Format
  4.              for Windows NT, March 1993 build.
  5.  
  6.  
  7.      Derived by inspection of the several supplied .ANI files.
  8.  
  9.  
  10.                    April 4, 1993
  11.                    Ross Berteig
  12.  
  13.  
  14.  
  15.  
  16. The .ANI file appears to consist of a sequence of named "tags", where a "tag"
  17. has the following structure:
  18.  
  19.     typedef struct tagANITAG {
  20.     char atName[8];
  21.     DWORD atSize;
  22.     BYTE atContents[0];
  23.     } ANITAG;
  24.  
  25. The first two tags are nested, and the entire remaining content of the
  26. file is nested inside of the second tag.  Without further examples, or a
  27. good guess at the meanings of "ASDFCONT" and "RAD CONT", it is difficult
  28. to see a reason for this nesting.
  29.  
  30. The next few tags provide general information about the file, including a
  31. title string, and an author string.  Microsoft seems to put a descriptive
  32. comment in the title string, and use the author string for a copyright
  33. message.  These strings are displayed in the Cursors Control panel applet,
  34. below the listbox of cursors.
  35.  
  36. It also appears that it is possible to crash CONTROL.EXE by putting more
  37. than 70 characters (or so... 70 works, 80 doesn't) in either of these
  38. strings.  It would appear that the buffer was allocated on the stack, and
  39. that the tag size was not checked for buffer overflow before the tag was
  40. read. If CONTROL.EXE had access rights that the user didn't, this might
  41. represent a back-door of sorts.
  42.  
  43. The real file header is found in an ANIHDATA tag.  This tage contains a 36
  44. byte structure which appears to be mostly zero in all of the examples.  If
  45. considered as an array of DWORDS, the first element is the structure size,
  46. the second and third are both set to the number of frames of animation,
  47. and all but the last two are zero.  The last one is always one in the
  48. examples (and if set to other than 1, the animation fails). The next to
  49. last field sets the duration of a single frame, in 1/60 of a second units.
  50.  
  51. The ANIHDATA tag is followed by a series of ICONDATA tags.  Each ICONDATA
  52. tag contains a verbatim copy of a Windows 3.1 .CUR file consisting of a
  53. single animation frame.
  54.  
  55. The complete .ANI file can be sumarized as follows:
  56.  
  57.     "ASDFCONT" { 
  58.       "RAD CONT" {
  59.         "TITLDATA" { "title text string" }
  60.         "AUTHDATA" { "author text string" }
  61.         "ANIHDATA" { .ANI Header Structure }
  62.         "ICONDATA" { copy of a .CUR file }
  63.     "ICONDATA" { copy of a .CUR file }
  64.           .
  65.           .
  66.           .
  67.       }
  68.     }
  69.  
  70.  
  71. To simplify the construction of .ANI files, I have implemented a simple
  72. compiler, AC.  AC is driven by a project file which allows for the title
  73. and author strings and frame rate to be set, and the listing of the .CUR
  74. files to include for the individual frames.
  75.  
  76. Animation project files are assumed to have the suffix .APJ, and are made
  77. up of two sections. The first section is the [Options] section, which
  78. contains settings global to the animation. The second section is the
  79. [Frames] section, which contains a list of the .CUR files to be included.
  80.  
  81. All of the header fields (aside from the frame rate) will be initialized
  82. automatically  by AC. In particular, both of the fields that appear to
  83. contain a count of the frames will contain copies of the actual count of
  84. frame files named in the [Frames] section.
  85.  
  86. The syntax is similar to that used by WIN.INI, and the input is in fact
  87. parsed by GetPrivateProfileString(), so all of the usual conventions
  88. apply.  Sections other than [Options] and [Frames] will be ignored, as
  89. will blank lines, and lines beginning with a semicolon. Due to a quirk of
  90. the GetPrivateProfile...() functions, the frames are listed one per line,
  91. as the values for any names in the [Frames] section.
  92.  
  93. A sample .APJ file that produces an .ANI file with 2 frames at a rate of 
  94. 6 frames/sec would look like the following:
  95.  
  96.     [Options]
  97.     Title=Sample Animation Project
  98.     Author=John Doe, Copyright.
  99.     Delay=10
  100.  
  101.     [Frames]
  102.     x=frame1.cur
  103.     x=frame2.cur
  104.  
  105. Version 1.1 of AC limits the size of the Title and Author strings so as 
  106. to avoid the stack overflow bug in control.exe.  In addition, a string tag
  107. called LICENSE can be added to an .ANI file to hold any additional
  108. copyright or license text. This string is unlimited, and will not be
  109. displayed by control.exe.
  110.